
<div class="row-fluid">

  <div style="height:30px;">
  </div>
    

  <div class="row-fluid">
    <div class="col-lg-2 col-md-2 col-xs-2">
<%= link_to new_p_entry_path, class: "btn btn-info btn-xlarge" do %>
        <span class="glyphicon glyphicon-plus" style='color:white;font-size:35px'/>
        </span>
        <br>
        <font color="white" font-family="Arial">New Entry</font>
        <br>
      <% end %>
      <div id="input_date2" class="datepicker" data-behaviour='datepicker'></div>
      <script type="text/javascript">
              $(document).ready(function(){

                 $('[data-behaviour~=datepicker]').datepicker({
                     format: 'yyyy-mm-dd',
                     todayBtn: "linked",
                     todayHighlight: true,
                     endDate: '0d',
                     autoclose: true
                 }).on('changeDate', dateChanged);


                 var today = new Date();
                 var dd = today.getDate();
                 var mm = today.getMonth()+1; //January is 0!
                 var yyyy = today.getFullYear();
                 

                 if(dd<10) {
                     dd='0'+dd
                 } 
                 
                 if(mm<10) {
                     mm='0'+mm
                 } 
                 
                 today = yyyy+'/'+mm+'/'+dd;

                // $('#input_date2').datepicker('setDate',today);

                 // alert(today)
                 $('[data-behaviour~=datepicker]').datepicker('setDate',today);

               })

             
              function dateChanged(ev) {
                  // var date=$('#input_date').val();
                   var date=$('[data-behaviour~=datepicker]').datepicker('getDate');


                  //alert(date);

                  // var element = document.getElementById("datetext");
                  // alert(element.innerHTML);
                  // element.innerHTML = date;
                  // alert(element.innerHTML);

                var e = document.getElementById("ordertype");
                var ordertype = e.options[e.selectedIndex].value;

                 $.ajax({
                    type: "GET",
                    url: "/",
                    dataType: "script" ,
                    data: {  date: date ,ordertype: ordertype}
                  })
                 .success(function(data){
                   // disaply new charge in the table 
                   // $('your div').html(data.html);
        

                 //  alert(data)
                   });
                  return false; // prevents normal behaviour

               }
          </script>

          <%= select_tag 'ordertype', options_for_select([['Create Time', 'created_at'], ['Updated Time', 'updated_at'], ['Status','status']],'created_at'),:onchange => 'dateChanged()',:style => 'margin-left:40px;'%>

            </div>
         

    <div class="col-lg-10 col-md-10 col-xs-10" style='margin-top:-25px;'>

      <div class="col-lg-8 col-md-8 col-xs-8"></div>
      <div class="col-lg-4 col-md-2 col-xs-4">


      <div id="show_date_status_id" style="float: right;color:#666"></div>
      <br>



      </div>
      <!-- <input type="text" class="datepicker" id="input_date" data-behaviour='datepicker' > -->
      <!-- <input type="text" class="datepicker"></input> -->
          
      </input>

      <div id="showentries"></div>
    

   
  </div>
</div>
</div>
